package com.springmvc.t11.config;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;
import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class MyTomcat implements WebFactory {
	@Override
	public void createServer() throws LifecycleException {
		//启动tomcat7
		Tomcat tomcat = new Tomcat();
		tomcat.setPort(8088);

		tomcat.addWebapp("/","D:\\temp");//完成监听
		tomcat.start();
		tomcat.getServer().await();//阻塞   socket监听

	}
}
